<html>
<head><meta charset="utf-8"><title>lint attributes with optional message · clippy · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/index.html">clippy</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/lint.20attributes.20with.20optional.20message.html">lint attributes with optional message</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="228045047"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/lint%20attributes%20with%20optional%20message/near/228045047" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matthiaskrgr <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/lint.20attributes.20with.20optional.20message.html#228045047">(Feb 27 2021 at 09:01)</a>:</h4>
<p>just had an idea; what if we had lint allow/deny attributes with some kind of message field<br>
<code>#![allow(unused_variables, "this is ok because foo")]</code><br>
For clippy, people could then comment inside if they ignored a lint because they don't care or if it's a false positive</p>
<div class="codehilite"><pre><span></span><code>#![allow(clippy::badlint, &quot;I really hate this lit, nothing personal, clippy&quot;)
</code></pre></div>
<p>We would then have direct feedback which we could collect over the github search or looking into the cargo cache where the extracted sources live...</p>



<a name="228069213"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/lint%20attributes%20with%20optional%20message/near/228069213" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/lint.20attributes.20with.20optional.20message.html#228069213">(Feb 27 2021 at 16:50)</a>:</h4>
<p>why not just use comments around the attribute?</p>



<a name="228073870"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/lint%20attributes%20with%20optional%20message/near/228073870" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matthiaskrgr <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/lint.20attributes.20with.20optional.20message.html#228073870">(Feb 27 2021 at 18:14)</a>:</h4>
<p>the comments can be everywhere around it and theres no convention afaik</p>



<a name="228075414"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/lint%20attributes%20with%20optional%20message/near/228075414" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> xFrednet <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/lint.20attributes.20with.20optional.20message.html#228075414">(Feb 27 2021 at 18:43)</a>:</h4>
<p>I'm definitely in favor of this as long as it's an optional field. There is an <a href="https://github.com/rust-lang/rfcs/pull/2383">RFC</a> and issue(<a href="https://github.com/rust-lang/rust/issues/54503">rust#54503</a>) on the topic of adding a <code>reason</code> field to the allow attribute in Rust. But there seems to be no real update on it since  2020-11-03. That might be something to look into <span aria-label="upside down" class="emoji emoji-1f643" role="img" title="upside down">:upside_down:</span></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>